package com.zheng.oa.common.utils;

import java.util.Calendar;

/**
 * Created by IntelliJ IDEA.
 * User: xinqi
 * Date: 2018/4/29
 * Time: 15:11
 */
public class TimeStampUtil {
    public static Long timeStampChange(Long timeStamp) {
        if(timeStamp.toString().length() == 10){
            timeStamp *= 1000;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(timeStamp);
        calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH),
                calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), 0);
        return calendar.getTimeInMillis() ;
    }
    public static void main(String[] args) {
        System.out.println(timeStampChange(1522555402L));
    }
}
